//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.smartstate.dataManagement.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@EnableJpaAuditing
@MappedSuperclass
public class BaseEntity<V extends BaseVO, D extends BaseDTO> implements Serializable {
    @ApiModelProperty
    @TableId(
        type = IdType.ASSIGN_UUID
    )
    @Id
    private String id;
    @ApiModelProperty
    @TableField(
        value = "create_time",
        fill = FieldFill.INSERT
    )
    @JSONField(
        format = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(
        pattern = "yyyy-MM-dd HH:mm:ss",
        timezone = "GMT+8"
    )
    @Column(
        name = "create_time"
    )
    private LocalDateTime createTime;
    @ApiModelProperty
    @TableField(
        value = "update_user",
        fill = FieldFill.UPDATE
    )
    @Column(
        name = "update_user"
    )
    private String updateUser = null;
    @ApiModelProperty
    @TableField(
        value = "update_time",
        fill = FieldFill.INSERT_UPDATE
    )
    @JSONField(
        format = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(
        pattern = "yyyy-MM-dd HH:mm:ss",
        timezone = "GMT+8"
    )
    @Column(
        name = "update_time"
    )
    private LocalDateTime updateTime;
    @TableField(
        value = "create_user",
        fill = FieldFill.INSERT_UPDATE
    )
    @ApiModelProperty
    @Column(
        name = "create_user"
    )
    private String createUser;

    public BaseEntity(D data) {
        this.createTime = data.getCreateTime();
        this.createUser = data.getCreateUser();
        this.updateUser = data.getUpdateUser();
        this.updateTime = data.getUpdateTime();
        this.id = data.getId();
    }

    @Transient
    public V getVo(V v) {
        v.setCreateUser(this.getCreateUser());
        v.setCreateTime(this.getCreateTime());
        v.setUpdateTime(this.getUpdateTime());
        v.setUpdateUser(this.getUpdateUser());
        v.setId(this.id);
        return v;
    }

    public String getId() {
        return this.id;
    }

    public LocalDateTime getCreateTime() {
        return this.createTime;
    }

    public String getUpdateUser() {
        return this.updateUser;
    }

    public LocalDateTime getUpdateTime() {
        return this.updateTime;
    }

    public String getCreateUser() {
        return this.createUser;
    }

    public void setId(final String id) {
        this.id = id;
    }

    @JsonFormat(
        pattern = "yyyy-MM-dd HH:mm:ss",
        timezone = "GMT+8"
    )
    public void setCreateTime(final LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public void setUpdateUser(final String updateUser) {
        this.updateUser = updateUser;
    }

    @JsonFormat(
        pattern = "yyyy-MM-dd HH:mm:ss",
        timezone = "GMT+8"
    )
    public void setUpdateTime(final LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public void setCreateUser(final String createUser) {
        this.createUser = createUser;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof BaseEntity)) {
            return false;
        } else {
            BaseEntity<?, ?> other = (BaseEntity)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label71: {
                    Object this$id = this.getId();
                    Object other$id = other.getId();
                    if (this$id == null) {
                        if (other$id == null) {
                            break label71;
                        }
                    } else if (this$id.equals(other$id)) {
                        break label71;
                    }

                    return false;
                }

                Object this$createTime = this.getCreateTime();
                Object other$createTime = other.getCreateTime();
                if (this$createTime == null) {
                    if (other$createTime != null) {
                        return false;
                    }
                } else if (!this$createTime.equals(other$createTime)) {
                    return false;
                }

                label57: {
                    Object this$updateUser = this.getUpdateUser();
                    Object other$updateUser = other.getUpdateUser();
                    if (this$updateUser == null) {
                        if (other$updateUser == null) {
                            break label57;
                        }
                    } else if (this$updateUser.equals(other$updateUser)) {
                        break label57;
                    }

                    return false;
                }

                Object this$updateTime = this.getUpdateTime();
                Object other$updateTime = other.getUpdateTime();
                if (this$updateTime == null) {
                    if (other$updateTime != null) {
                        return false;
                    }
                } else if (!this$updateTime.equals(other$updateTime)) {
                    return false;
                }

                Object this$createUser = this.getCreateUser();
                Object other$createUser = other.getCreateUser();
                if (this$createUser == null) {
                    if (other$createUser == null) {
                        return true;
                    }
                } else if (this$createUser.equals(other$createUser)) {
                    return true;
                }

                return false;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof BaseEntity;
    }

    public int hashCode() {
//        int PRIME = true;
        int result = 1;
        Object $id = this.getId();
        result = result * 59 + ($id == null ? 43 : $id.hashCode());
        Object $createTime = this.getCreateTime();
        result = result * 59 + ($createTime == null ? 43 : $createTime.hashCode());
        Object $updateUser = this.getUpdateUser();
        result = result * 59 + ($updateUser == null ? 43 : $updateUser.hashCode());
        Object $updateTime = this.getUpdateTime();
        result = result * 59 + ($updateTime == null ? 43 : $updateTime.hashCode());
        Object $createUser = this.getCreateUser();
        result = result * 59 + ($createUser == null ? 43 : $createUser.hashCode());
        return result;
    }

    public String toString() {
        String var10000 = this.getId();
        return "BaseEntity(id=" + var10000 + ", createTime=" + this.getCreateTime() + ", updateUser=" + this.getUpdateUser() + ", updateTime=" + this.getUpdateTime() + ", createUser=" + this.getCreateUser() + ")";
    }

    public BaseEntity() {
    }
}
